var request = require('request');
var api = {};
api.getTypeAll = function(cb) {
    var url = 'http://101.71.57.211:81/index.php?mod=course&action=cate&do=index&api=json&client=pc';
    request.get({
        url: url,
    }, function(err, httpResponse, body) {
    	console.lo
        if (!err) {
            var result = JSON.parse(body);
            console.log(result.code);
            if (result.code === '0') {
                var data = result.data;
                
                console.log(result.data);
                cb(null, data);
            } else {
                cb(result.code);

            }
        } else {
            cb('-1');
        }
    });
}

module.exports = api;